﻿using System.ComponentModel.Composition;
using System.IO;
using VsPackageCommon;

namespace NotifyPropertyWeaverVsPackage
{
    [Export, PartCreationPolicy(CreationPolicy.Shared)]
    public class FileExporter
    {
        ResourceExporter resourceExporter;

        public FileExporter()
        {
            resourceExporter = new ResourceExporter();
        }

        [ImportingConstructor]
        public FileExporter(ResourceExporter resourceExporter)
        {
            this.resourceExporter = resourceExporter;
        }

        public bool ExportTask(string directory)
        {
            return resourceExporter.Export("NotifyPropertyWeaverMsBuildTask.dll", new FileInfo(Path.Combine(directory, "NotifyPropertyWeaverMsBuildTask.dll")));
        }

        public bool ExportTask(DirectoryInfo directory)
        {
            return resourceExporter.Export("NotifyPropertyWeaverMsBuildTask.dll", new FileInfo(Path.Combine(directory.FullName, "NotifyPropertyWeaverMsBuildTask.dll")));
        }

        public void ExportAttribute(DirectoryInfo directory, string frameworkType)
        {
            resourceExporter.Export(frameworkType + ".NotifyPropertyWeaver.dll", new FileInfo(Path.Combine(directory.FullName, "NotifyPropertyWeaver.dll")));
            resourceExporter.Export("NotifyPropertyWeaver.xml", new FileInfo(Path.Combine(directory.FullName, "NotifyPropertyWeaver.xml")));
        }

  

    }
}